package org.example.controller.admin;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.example.entity.Dingdan;
import org.example.entity.Pinjia;
import org.example.result.Result;
import org.example.service.PinjiaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/admin/pinjia")
@Slf4j
@Api(tags = "评价相关接口")
public class EmployeeppinjiaController {
    @Autowired
    PinjiaService pinjiaService;
    /**
     * 新增评价
     * @param
     * @return
     */
    @PostMapping("/pjxz")
    @ApiOperation(value = "新增评价")
    public Result pjxz(@RequestBody Pinjia pinjia) {
        log.info("订单{}",pinjia);
        pinjiaService.xz(pinjia);
        return Result.success();
    }

    /**
     * 查询评价
     * @param
     * @return
     */
    @GetMapping("/cx")
    @ApiOperation(value = "查询评价")
    public Result<List<Pinjia>> pjxz(@RequestParam( "id") int id) {
        log.info("订单{}",id);
        return Result.success( pinjiaService.cxsy(id));
    }

}
